Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[various] Add iOS privacy manifests #5846

Merged
merged 11 commits into from
Jan 12, 2024

Conversation

stuartmorgan
Copy link
Contributor

Adds privacy manifests to all iOS plugins.

While we only need to do the plugins listed here for now, the wording of the page:

The following are commonly used SDKs in apps on the App Store

suggests that the list of things for which this is required is just an arbitrary cutoff rather than a conceptual distinction, so it seems safest to just assume the list will grow over time and do all of them. To ensure that, this includes new repo tooling to check that a manifest is specified in the podspec.

The large caveat is that we do not currently know if this actually works. This is the method of inclusion that seems to be the consensus among people using Cocoapods, as bundling it directly as a resource causes problems for clients who do not use use_frameworks. (In theory it seems like a manifest would not actually be required in that case since there is no framework, but it has the potential to actually stomp top-level resources.) Hopefully the automated analysis that Apple will eventually roll out will tolerate the file being bundled in a resource bundle in the framework rather than a top-level manifest file. If not, however, it's not clear how Cocoapods can be supported, so we can adopt this common approach for now under the assumption that eventually tooling will adapt to the reality of the ecosystem, and revisit the exact bundling later if necessary.

Only shared_preferences has a non-empty manifest, as it is our only plugin that uses a required reason API, and none of our plugins themselves collect private data. Ideally for that plugin we would instead use C56D.1, which is for wrappers, but as currently written we can't use it since it's exclusively a wrapper. If that changes in the future based on our pending request, we can revisit. For now, however, this reason should suffice since we don't currently allow reading from other app groups.

Fixes flutter/flutter#131495
Fixes flutter/flutter#139756
Fixes flutter/flutter#139757
Fixes flutter/flutter#139758
Fixes flutter/flutter#139759
Fixes flutter/flutter#139760
See also flutter/flutter#139761

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@omarzl
Copy link

omarzl commented Jan 8, 2024

Consider setting a different name for the resource bundle name since Cocoapods will generate the same bundle id for the framework (if linked dynamically) and for the resource bundle.

For example:
A framework camera_avfoundation.framework would have the bundle id org.cocoapods.camera_avfoundation in its Info.plist
and the resource bundle camera_avfoundation.bundle will have the same one org.cocoapods.camera_avfoundation

We have had issues in the past with this id collision (like images not been displayed) since iOS loads the bundles and registers them with their id, not the filename nor file location.

Example of suggested changes:

 s.name             = 'camera_avfoundation'
 s.resource_bundles = {'camera_avfoundation_resources' => ['Resources/PrivacyInfo.xcprivacy']}

If I should guess, in this scenario it won't cause any issue. But if in the future you need to include any other asset in those resource bundles and access them using Bundle(identifier:) it could cause a problem

@stuartmorgan stuartmorgan deleted the privacy-manifests branch January 12, 2024 15:16
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 12, 2024
flutter/packages@0744fe6...d74d687

2024-01-12 [email protected] [ci] Check repo-level package metadata (flutter/packages#5811)
2024-01-12 [email protected] [various] Add iOS privacy manifests (flutter/packages#5846)
2024-01-11 [email protected] [video_player] Skip flaky tests in certain circumstances on Android (flutter/packages#5872)
2024-01-11 [email protected] Roll Flutter (stable) from 78666c8 to 46787ee (5 revisions) (flutter/packages#5870)
2024-01-11 [email protected] Roll Flutter from b840a60 to 9f2e681 (24 revisions) (flutter/packages#5871)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@reidbaker reidbaker mentioned this pull request Jan 12, 2024
sybrands-place pushed a commit to sybrands-place/packages that referenced this pull request Jan 16, 2024
* main: (186 commits)
  Roll Flutter from 7dc856a to 1a2c315 (23 revisions) (flutter#5895)
  [webview_flutter_android] Add test that `onReceivedHttpAuthRequest` is cancelled by default  (flutter#5723)
  Roll Flutter (stable) from 46787ee49c1f to ef1af02aead6 (1 revision) (flutter#5887)
  [google_maps_flutter] Drop iOS 11 support (flutter#5873)
  Roll Flutter from 9f2e681 to 7dc856a (15 revisions) (flutter#5882)
  [ci] Check repo-level package metadata (flutter#5811)
  [various] Add iOS privacy manifests (flutter#5846)
  [video_player] Skip flaky tests in certain circumstances on Android (flutter#5872)
  Roll Flutter (stable) from 78666c8dc57e to 46787ee49c1f (5 revisions) (flutter#5870)
  Roll Flutter from b840a60 to 9f2e681 (24 revisions) (flutter#5871)
  [quick_actions_android] Close system dialogs for integration test (flutter#5853)
  [file_selector]: Bump androidx.annotation:annotation from 1.7.0 to 1.7.1 in /packages/file_selector/file_selector_android/android (flutter#5712)
  [in_app_pur]: Bump androidx.annotation:annotation from 1.7.0 to 1.7.1 in /packages/in_app_purchase/in_app_purchase_android/android (flutter#5713)
  [url_launcher]: Bump androidx.annotation:annotation from 1.7.0 to 1.7.1 in /packages/url_launcher/url_launcher_android/android (flutter#5708)
  [image_picker]: Bump androidx.annotation:annotation from 1.7.0 to 1.7.1 in /packages/image_picker/image_picker_android/android (flutter#5703)
  Roll Flutter from 126302d to b840a60 (29 revisions) (flutter#5855)
  Roll Flutter from c6ddb73 to 126302d (32 revisions) (flutter#5852)
  Bump github/codeql-action from 3.22.12 to 3.23.0 (flutter#5849)
  Re-land: Enable prefer_mixin and bump plugin_platform_interface to 2.1.7 (flutter#5841)
  [ci] Exclude quick_actions from Android emulators (flutter#5847)
  ...

# Conflicts:
#	packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m
aboedo pushed a commit to RevenueCat/purchases-ios that referenced this pull request Mar 26, 2024
### Motivation
The library already includes Privacy.xcprivacy in SPM, but when used
with CocoaPods (mandatory in Flutter), these files are not exported as
the podspec does not include that file as a resource bundle.

### Description
Listing the PrivacyInfo.xcprivacy file inside the resource_bundles
specification in the podspec allows to distribute the file correctly.
Ref.
CocoaPods/CocoaPods#10325 (comment)

This GitHub issue contains the entire discussion on how to add these
xcprivacy files and is referenced in multiple places; many libraries
already follow this approach:


https://github.com/firebase/firebase-ios-sdk/blob/main/FirebaseCrashlytics.podspec
SDWebImage/SDWebImage#3649
flutter/packages#5846
Baseflow/flutter-permission-handler#1291
Baseflow/flutter-geolocator#1462
aboedo added a commit to RevenueCat/purchases-ios that referenced this pull request Mar 27, 2024
#3775)

### Motivation
The library already includes Privacy.xcprivacy in SPM, but when used
with CocoaPods (mandatory in Flutter), these files are not exported as
the podspec does not include that file as a resource bundle.

### Description
Listing the PrivacyInfo.xcprivacy file inside the resource_bundles
specification in the podspec allows to distribute the file correctly.
Ref.

CocoaPods/CocoaPods#10325 (comment)

This GitHub issue contains the entire discussion on how to add these
xcprivacy files and is referenced in multiple places; many libraries
already follow this approach:



https://github.com/firebase/firebase-ios-sdk/blob/main/FirebaseCrashlytics.podspec
SDWebImage/SDWebImage#3649
flutter/packages#5846
Baseflow/flutter-permission-handler#1291
Baseflow/flutter-geolocator#1462

Co-authored-by: Sergio Durban Belmonte <[email protected]>
arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
Adds privacy manifests to all iOS plugins.

While we only *need* to do the plugins listed [here](https://developer.apple.com/support/third-party-SDK-requirements/) for now, the wording of the page:
> The following are commonly used SDKs in apps on the App Store

suggests that the list of things for which this is required is just an arbitrary cutoff rather than a conceptual distinction, so it seems safest to just assume the list will grow over time and do all of them. To ensure that, this includes new repo tooling to check that a manifest is specified in the podspec.

The large caveat is that we do not currently know if this actually works. This is the method of inclusion that seems to be [the consensus among people using Cocoapods](CocoaPods/CocoaPods#10325), as bundling it directly as a `resource` causes problems for clients who do not use `use_frameworks`. (In theory it seems like a manifest would not actually be *required* in that case since there is no framework, but it has the potential to actually stomp top-level resources.) Hopefully the automated analysis that Apple will eventually roll out will tolerate the file being bundled in a resource bundle in the framework rather than a top-level manifest file. If not, however, it's not clear how Cocoapods can be supported, so we can adopt this common approach for now under the assumption that eventually tooling will adapt to the reality of the ecosystem, and revisit the exact bundling later if necessary.

Only `shared_preferences` has a non-empty manifest, as it is our only plugin that uses a required reason API, and none of our plugins themselves collect private data. Ideally for that plugin we would instead use `C56D.1`, which is for wrappers, but as currently written we can't use it since it's exclusively a wrapper. If that changes in the future based on our pending request, we can revisit. For now, however, this reason should suffice since we don't currently allow reading from other app groups.

Fixes flutter/flutter#131495
Fixes flutter/flutter#139756
Fixes flutter/flutter#139757
Fixes flutter/flutter#139758
Fixes flutter/flutter#139759
Fixes flutter/flutter#139760
See also flutter/flutter#139761
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment